package com.xue.my.protocol;

import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import com.xue.my.protocol.codec.ProtocolTypeEnum;

/**   
 * @Title: MessageCodecFactory.java 
 * @Package com.xue.my.protocol 
 * @Description: TODO
 * @author jimmy lovelyxuehanxin@163.com   
 * @date 2013-7-23 下午8:20:54 
 */
public class MessageCodecFactory {
	
	private Map<String, MessageDecoder> msgDecoderMap;
	private Map<String, MessageEncoder> msgEncoderMap;
	
	public MessageDecoder getMessageDecoderCodec(HttpServletRequest request){
		String msgCode = request.getHeader("msgType");
		if(msgCode.endsWith(ProtocolTypeEnum.JSONMSGTYPE.getCode())){
			return msgDecoderMap.get(msgCode);
		}
		return null;
	}
	public MessageEncoder getMessageEncoderCodec(HttpServletRequest request){
		return null;
	}
	public Map<String, MessageDecoder> getMsgDecoderMap() {
		return msgDecoderMap;
	}
	public void setMsgDecoderMap(Map<String, MessageDecoder> msgDecoderMap) {
		this.msgDecoderMap = msgDecoderMap;
	}
	public Map<String, MessageEncoder> getMsgEncoderMap() {
		return msgEncoderMap;
	}
	public void setMsgEncoderMap(Map<String, MessageEncoder> msgEncoderMap) {
		this.msgEncoderMap = msgEncoderMap;
	}
	
	
	
}
